package com.byedu.course.util;

import com.byedu.domain.focus.vo.FocusUserVO;
import com.byedu.mail.MailInfo;
import com.byedu.mail.MailSender;

/**
 * Created by Luo on 2017-09-14.
 */
public class FocusMailUtil {


    public static boolean mailsend(FocusUserVO focusUserVO)  {

        boolean flag =false;
        if(focusUserVO.getUf()> 0) {
            // 插入邮件发送记录
            String[] contents = new String[5];
            contents[0] = "您有" + focusUserVO.getUf() + "条待处理项目，请登录系统处理";
            contents[1] = "富博思管理系统：http://jaad-app.cn/Focus/admin";
            contents[2] = "账号/密码：" + focusUserVO.getUsername() + " / " + focusUserVO.getPassword();
            contents[3] = "富博思管理系统（备份系统）：http://jco-app.cn/Focus/admin";
            contents[4] = "账号/密码：" + focusUserVO.getUsername() + " / " + focusUserVO.getPassword();
            MailSender mailSender = MailSender.getInstance();

        MailInfo mailInfo = mailSender.setMailInfo(focusUserVO.getEmail(), "富博思绩效管理系统",
                contents, null);
//            MailInfo mailInfo = mailSender.setMailInfo("robotl@focus-insight.com", "富博思绩效管理系统",
//                    contents, null);
            try {
                flag = mailSender.sendHtmlMail(mailInfo, 3);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return flag ;
    }


    public static boolean mailsendworker(FocusUserVO focusUserVO)  {

        boolean flag =false;
        if(focusUserVO.getUf()> 0) {
            // 插入邮件发送记录
            String[] contents = new String[5];
            contents[0] = "您有新的工单要处理，请登录系统处理";
            contents[1] = "富博思管理系统：http://jaad-app.cn/Focus/admin";
            contents[2] = "账号/密码：" + focusUserVO.getUsername() + " / " + focusUserVO.getPassword();
            contents[3] = "富博思管理系统（备份系统）：http://jco-app.cn/Focus/admin";
            contents[4] = "账号/密码：" + focusUserVO.getUsername() + " / " + focusUserVO.getPassword();
            MailSender mailSender = MailSender.getInstance();
            MailInfo mailInfo = mailSender.setMailInfo(focusUserVO.getEmail(), "富博思绩效管理系统",
             contents, null);
//            MailInfo mailInfo = mailSender.setMailInfo("robotl@focus-insight.com", "富博思绩效管理系统",
//                    contents, null);
            try {
                flag = mailSender.sendHtmlMail(mailInfo, 3);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return flag ;
    }

    public static void main(String[] args) throws Exception {
//        FocusUserVO focusUserVO = new FocusUserVO();
//        focusUserVO.setEmail("robotl@focus-insight.com");
//        mailsend(focusUserVO);
        double a1 =1273647327.0;
        double a2= 647;
        System.out.print(a1/a2);
    }
}
